
import logging,HTMLTestRunner_cn,pytest
import time,yagmail
class Tools():
    def log(self):
        et=time.strftime('%Y%m%%d%H%M%S',time.localtime())
        logging.basicConfig(filename='126.log', filemode='a+', level=logging.DEBUG,
                            format='%(filename)s %(levelname)s %(asctime)s %(message)s %(lineno)d')

    def htlm(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(open('126.html', 'w')
                                                  , title='测试报告'
                                                  , description='数据驱动')
        return report

    # 邮件
    def email(self):
        email = yagmail.SMTP(user='3499720017@qq.com', password='wilixxauutlichie', host='smtp.qq.com')
        email.send(to='3499720017@qq.com', subject='测试结果', contents='测试结果')
        email.close()

if __name__ == '__main__':
    Tools().log()
    Tools().email()
    pytest.main([r'E:\gaowu_2303A\Wzx\wzx9_23\jx_pytest\jx_pytest.py','-s','--html=jx.html'])